﻿'use strict';
(function () {
    // 注意JS的绑定顺序，第一组绑定的文件可以用angular.module('MyControllers', []);，后续的文件只能用angular.module('MyControllers')
    var service = angular.module('MyServices');

    service.factory('examPlanService', ['$http', function (http) {
        var methods = {
            // 考试计划
            'examPlanSrv': {
                getList: function (type) {
                    return http.post('/ExamPlan/GetList/', { planType: type ,account : commonFun.getCookie('account') });
                },
                localUpload: function () {
                    return http.post('/ExamPlan/LocalUpload/');
                }
            },

            // 批次列表
            'examBatch': {
                getBatchList: function (type) {
                    return http.post('/ExamPlan/GetBatchList/');
                },
                downloadPlan: function(deploymentMode,examplanUrl){
                    return http.post('/ExamPlan/onUploadExamPlanData/',{ "deploymentMode": deploymentMode, "examplanUrl": examplanUrl });
                },
                getExamPlanProgress: function(examPlanID){
                    return http.post('/ExamPlan/getExamPlanProgressInfo/',{ "examPlanID": examPlanID });
                },
                getSubjectList: function (examPlanID, currentPage, pageSize) {
                    return http.post('/ExamPlan/findExamSubjectList', {"examPlanID": examPlanID, "currentPage": currentPage, pageSize: pageSize});
                },
                getExamPaperProgress: function(examPlanID, reDownLoad){
                    return http.post('/ExamPlan/getExamSubjectPaperProgressInfo',{ "examPlanID": examPlanID, "reDownLoad": reDownLoad });
                },
                downLoadSubjectPaper: function(examPlanID){
                    return http.post('/ExamPlan/downLoadSubjectPaper',{ "examPlanID": examPlanID });
                }
            },

            // 生成试卷服务
            'examPaperSrv': {
                isRequireSetSeat: function (planId) {
                    return http.post('/ExamPlan/IsRequireSetSeat/', { planId: planId });
                },
                getPaperList: function (planId) {
                    return http.post('/ExamPlan/GetPaperList/', { planId: planId });
                },
                generationPaper: function (planId, subjectId) {
                    return http.post('/ExamPlan/GenerationPaper/', { planId: planId, subjectId: subjectId });
                },
                checkBeforeClean: function (planId, subjectId) {
                    return http.post('/ExamPlan/CheckBeforeClean/', { planId: planId, subjectId: subjectId });
                }
            },

            // 考场管理
            'managementSrv': {
                getPaperList: function (roomId) {
                    return http.post('Manager/ExamPlan/Getmanagement/', { roomId: roomId });
                }
            },

            // 查看明细服务
            'detailSrv': {
                getSceneList: function (planId, roomId, subjectId) {
                    return http.post('/ExamPlan/GetSceneList/', { planId: planId, roomId: roomId, subjectId: subjectId });
                },
                getRoomList: function (planId, sceneId, subjectId) {
                    return http.post('/ExamPlan/GetRoomList/', { planId: planId, sceneId: sceneId, subjectId: subjectId });
                },
                getSubjectList: function (planId, sceneId, roomId) {
                    return http.post('/ExamPlan/GetSubjectList/', { planId: planId, sceneId: sceneId, roomId: roomId });
                },
                getDetailList: function (planId, sceneId, roomId, subjectId) {
                    return http.post('/ExamPlan/GetDetailList/', { planId: planId, sceneId: sceneId, roomId: roomId, subjectId: subjectId  ,account : commonFun.getCookie('account')});
                },
                buildAccounts: function (count, planId, subjectId, sceneId, roomId) {
                    return http.post('/ExamPlan/BuildAccounts/', { count: count, planId: planId, subjectId: subjectId, sceneId: sceneId, roomId: roomId });
                }
            },

            // 上传本地考试计划包服务
            'uploadSrv': {

            },

            // 在线导入考试计划包服务
            'importSrv': { 

            },

            // 清理已生成的试卷服务
            'cleanSrv': {
                cleanPaper: function (planId, subjectId) {
                    return http.post('/ExamPlan/CleanPaper/', { planId: planId, subjectId: subjectId });
                },
                getMoniterStatus: function (planId, subjectId) {
                    return http.post('/ExamPlan/GetMoniterStatus/', { planId: planId, subjectId: subjectId });
                }
            }
        };
        return methods;
    }]);
})();